package de.openlaboratory.labhub.core.server;

import javax.servlet.http.HttpServletRequest;

import de.openlaboratory.labhub.core.framework.Command;

public class RequestHelper
{
	private Command command;

	public RequestHelper(HttpServletRequest request)
	{
		String commandString = (String) request.getAttribute("command");
		commandString = extractModuleName(commandString);
		this.command = new Command (commandString);
	}
	
	public Command getCommand()
	{
		return this.command;
	}
	
    private String extractModuleName(String path)
    {
        if(path == null || !path.startsWith("\\"))
        {
            return "genetracker";
        }
        else
        {
            return path.substring(1, path.length());
        }
    }
}
